package cn.team11.sdsPackager;

import android.content.pm.PackageInfo;

import com.aliyun.alink.sdk.jsbridge.BoneCallback;
import com.aliyun.alink.sdk.jsbridge.methodexport.BaseBonePlugin;
import com.aliyun.alink.sdk.jsbridge.methodexport.MethodExported;

import org.json.JSONObject;

import cn.team11.util.T11Log;
import cn.team11.util.T11Util;

public class T11ShellVersionPlugin extends BaseBonePlugin {

    public static final String API_NAME = "T11ShellVersionPlugin";

    @MethodExported
    public void getShellVersionInfo(String arg1, BoneCallback boneCallback) {
        try {
            PackageInfo info = T11Util.getPkgInfo(this.context);
            JSONObject versionInfo = new JSONObject();
            versionInfo.put("verCode", info.versionCode);
            versionInfo.put("verName", info.versionName);
            boneCallback.success(versionInfo);
        } catch (Exception e) {
            T11Log.e("open data failed", e);
        }
    }
}
